/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cyss.greenball.util;

import com.cyss.greenball.service.DelGreenBallMapService;
import com.cyss.greenball.service.ShowGreenBallMapService;
import com.cyss.greenball.service.SubmitGreenBallMapService;
import com.lianzt.commondata.AbstractCommonData;
import com.lianzt.commondata.DataConvertFactory;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author cyss
 */
public class SystemUtil {
    public static Map<String,AbstractCommonData> ServiceCodeAndDesc = new HashMap<String,AbstractCommonData>();
    public static Map<String,Class> ServiceCollection = new HashMap<String,Class>();
    
    static{
        ServiceCodeAndDesc.put("success", putServiceCode("000000","执行成功！"));
        ServiceCodeAndDesc.put("insertGreenBallFail", putServiceCode("000001","插入地图失败！"));
        ServiceCollection.put("M001", SubmitGreenBallMapService.class);
        ServiceCollection.put("M002", ShowGreenBallMapService.class);
        ServiceCollection.put("M003", DelGreenBallMapService.class);
    }
    
    private static AbstractCommonData putServiceCode(String code, String desc){
        AbstractCommonData acd = DataConvertFactory.getInstanceEmpty();
        acd.putStringValue("code", code);
        acd.putStringValue("desc", desc);
        return acd;
    }
    
    public static AbstractCommonData getBacdCommonData(AbstractCommonData codeDesc){
        AbstractCommonData bacdAcd = DataConvertFactory.getInstance();
        AbstractCommonData bacdAcdHead = bacdAcd.getDataValue("head");
        bacdAcdHead.putStringValue("code", codeDesc.getStringValue("code"));
        bacdAcdHead.putStringValue("desc", codeDesc.getStringValue("desc"));
        return bacdAcd;
    }
}
